<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ page import="com.yls.except.util.GeneralResult" %>
<%@ page import="org.json.JSONArray" %>
<%@ page import="com.yls.except.util.StringIsempty" %>
<%@ page import="org.json.JSONObject" %>
<%@ page import="java.net.URLDecoder" %>

<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML>
<html>
<head>
    <base href="<%=basePath%>">
    <title>下单</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>

    <!-- 加载Css 样式 -->
    <link href="css/ConfirmOrder_Css.css" rel="stylesheet" type="text/css"/>

    <script type="text/javascript" src="js/jquery-1.11.3.min.js"></script>
    <script type="text/javascript" src="js/public.js"></script>
    <script type="text/javascript" src="js/indent/pre_order.js"></script>
    <script>
        function back() {
            window.history.back(-1);
        }
    </script>
</head>

<body style="background-color: #F2F2F2;">
<form id="order_frm" method="post">
    <jsp:include page="/public.jsp"/>
    <input type="hidden" value="<%=request.getParameter("shopinfo")%>" name="shopinfo"/>
    <input type="hidden" id="addressid" name="addressid" value="<%=request.getParameter("addressid")%>"/>
    <input type="hidden" id="addressname" name="addressname" value="<%=request.getParameter("addressname")%>"/>
    <input type="hidden" id="addressphone" name="addressphone" value="<%=request.getParameter("addressphone")%>"/>
    <input type="hidden" id="addressdesc" name="address" value="<%=request.getParameter("address")%>"/>
    <input type="hidden" id="indentnum" name="indentnum"/>
    <input id="isnoaddress" type="hidden"/>
</form>
<form id="payinfo" method="post" action="/except/files/pay.jsp">
    <input type="hidden" name="indenttype" id="1"/>
    <input type="hidden" name="nonce_str" id="nonce_str"/>
    <input type="hidden" name="result_sign" id="result_sign"/>
    <input type="hidden" name="timestamp" id="timestamp"/>
    <input type="hidden" name="prepay_id" id="prepay_id"/>
</form>

<div class="delivery_method" id="delivery_method">
    <span class="span_one">配送方式</span>
    <input class="radio_type" type="radio" name="delivery" value="0" checked="checked"/> <span
        class="span_two">订单配送</span>
    <input class="radio_type" type="radio" name="delivery" value="1"/> <span class="span_two">商品仓储</span>
</div>

<!-- 自定以  hr -->
<hr style="height: 1px; width: 97%; float: right; background-color: #f4f4f4; border: none;"/>

<!-- 仓储信息 -->
<div class="clearboth" style="background-color: white;display: none;" id="delivery_desc">

    <div style="float: left;padding: 10px;">
        <span style="font-size: 15px;color: #6d6d6d;">仓储功能</span>
    </div>

    <div style="float: left; width: 60%;padding: 10px;">
        <span>这里将加载一些关于仓储的信息展示。这里将加载一些关于仓储的信息展示。这里将加载一些关于仓储的信息展示。</span>
    </div>
</div>
<!-- 10px过度线 -->
<div class="clearboth" style="border: solid #f4f4f4 5px;">
</div>

<div id="shop_address" onclick="location.href='/except/files/user/my_shop_address.jsp?upurl=/except/files/indent/pre_order.jsp'">
    <!-- 加载地址 -->
    <div>
        <div class="show_address">
            <div class="left">
                <img class="img_size" src="img/consignee.png"/>
                <span class="username" id="username"></span>
            </div>
            <div class="right">
                <img class="img_size" src="img/cellphone.png"/>
                <span class="phone" id="phone"><i></i></span>
            </div>
        </div>

        <div class="show_address_out">
            <div class="address_div">
                <img class="img_size" src="img/address.png"/>
            </div>
            <div style="width: 85%;float: left;margin-bottom: 15px;">
                <span class="address" id="address"></span>
            </div>
        </div>
    </div>
    <div style="height: 3px;">
        <img src="img/Addsplit.png" class="address_hr"/>
    </div>
</div>
</span>

<span id="no_address" onclick="add_address();">
    <div class="clearboth"></div>
    <div style="text-align: center;background-color:  white;height: 80px;line-height: 80px;">
        <img src="img/addition_icon.png" style="height: 20px;width: 20px;vertical-align: middle;"/>
        <span style="margin-left: 3px;vertical-align: middle;">添加收货地址</span>
    </div>
    <div style="height: 3px;">
        <img src="img/Addsplit.png" class="address_hr"/>
    </div>
</span>

<!-- 实现订单列表 -->

<%
    String shopinfo = session.getAttribute("shopinfo") + "";
    if(StringIsempty.isallempty(shopinfo)) {
        shopinfo = request.getParameter("shopinfo");
        session.setAttribute("shopinfo", shopinfo);
    }
//    String shopinfo = request.getParameter("shopinfo");
//    session.setAttribute("shopinfo", shopinfo);
    if (!StringIsempty.isallempty(shopinfo)) {
        Map<String, Object> map = GeneralResult.jsonStrToMap(shopinfo);
        JSONArray shop = (JSONArray) map.get("shopinfo");
        if (shop != null && shop.length() > 0) {
            for (int i = 0; i < shop.length(); i++) {
                JSONObject jsonobject = shop.getJSONObject(i);
%>

<div class="store_name">
    <div style="float: left;">
        <img src="img/logo_icon.png" class="add_img"/>
        <span>摘记良品</span>
    </div>
    <!--<div style="float: right;">
        <img src="img/right.png" class="right_img" />
    </div>-->
</div>
<!-- 自定以  hr -->
<hr style="height: 1px; width: 100%; background-color: #f4f4f4; border: none;"/>

<!-- 商品详情 -->
<div class="goods">
    <input type="hidden" value="<%=jsonobject.get("shopid")%>"/>
    <input type="hidden" value="<%=jsonobject.get("age")%>"/>
    <input type="hidden" value="<%=jsonobject.get("sex")%>"/>
    <input type="hidden" value="<%=jsonobject.get("shopspecid")%>"/>
    <img src="<%=jsonobject.get("img")%>" class="item_img" onerror="imgerror(this,'img/onerror.png');"/>
    <ul class="item_ul">
        <li><span class="item_name"><%=jsonobject.get("shopname")%></span></li>
        <li>
            <div style="margin-top: 10px;">
                <span class="item_desc"><%=jsonobject.get("specname")%></span>
                <span class="item_buy_num">X<%=jsonobject.get("num")%></span>
            </div>
        </li>
        <li><span class="item_money">￥:<%=jsonobject.get("price")%></span></li>
    </ul>
</div>
<!-- 自定以  hr -->
<hr style="height: 1px; width: 97%; float: right; background-color: #f4f4f4; border: none;"/>
<%
            }
        }
    }

%>
<!-- 运费 -->
<div class="trans_div" id="freighinfo">
    <span class="tran_span">运费</span>
    <span class="tran_money">￥<i id="freight">10.00</i></span>
</div>
<!-- 自定以  hr -->
<hr style="height: 1px; width: 97%; float: right; background-color: #f4f4f4; border: none;"/>

<div class="trans_div_bttom">
    <span class="span_all_money">￥<i id="totalmoney">109.00</i></span>
    <span class="span_all_money">小计</span>
</div>

<!-- 底部数据统计 -->
<div class="bottom">
    <div class="left">
        <span>合计:</span>
        <span class="left_span">￥<i id="paymoney">109.00</i></span>
    </div>
    <div class="right" onclick="indent()">
        <span class="right_span">立即下单</span>
    </div>
</div>

<!-- 加载弹窗支付信息布局 -->

<!-- 这里需要把两个布局格式区分出来
      他本来就不属于在文档流中，position:fixed;或使他脱离文档流
     区分出来让他两个独立加载。
 -->
<div id="background" style="background: rgba(0,0,0,0.5);height: 100%;width: 100%;position: fixed;top: 0;display: none;"></div>
<div class="cqchoosenum">
    <div class="pop_pay">
        <div class="pop_title">
            <div class="pop_cancel">
                <img src="img/cancel.png" id="closeimg" onclick="showPopup();"/>
            </div>
            <div class="title">支付信息</div>
        </div>
        <hr style="height: 1px; width: 100%; float: right; background-color: #f4f4f4; border: none;"/>
        <div class="clearboth"></div>
        <div class="pay_style" id="paytype">
            <span class="span_one">支付方式</span>
            <input class="radio_type" type="radio" id="spare_pay" name="paytype" value="1"/> <span class="span_two">余额(￥<i id="sparemoney">200.00</i>)</span>
            <input class="radio_type_two" type="radio" id="wechat_pay" name="paytype" value="2"/> <span class="span_two">微信支付</span>
        </div>
        <hr style="height: 1px; width: 97%; float: right; background-color: #f4f4f4; border: none;"/>
        <div class="pay_money_div">
            <span style="font-size: 16px;">应付金额</span>
            <span class="pay_money">￥:<i id="money">109.00</i></span>
        </div>
        <!-- 确认支付 -->
        <div id="buy" class="buy_bg" onclick="pay_indent();">
            <span style="width: 90%;font-size: 16px;color: white;">确认支付</span>
        </div>
    </div>
</div>
<jsp:include page="/files/public_hint.jsp"/>
</body>
</html>